package com.work.straighttalk.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;

import com.facebook.drawee.view.SimpleDraweeView;
import com.work.straighttalk.R;
import com.work.straighttalk.bean.MyConversation;

import butterknife.Bind;


/**
 * Created by dllo on 16/3/3.
 */
public class ConversationViewHolder extends BaseViewHolder<MyConversation> {

    @Bind(R.id.sd_avater)
    SimpleDraweeView sdAvater;
    @Bind(R.id.tv_name)
    TextView tvName;
    @Bind(R.id.tv_date)
    TextView tvDate;
    @Bind(R.id.tv_last_infor)
    TextView tvLastInfor;
    private OnRecyclerViewClickListener listener;

    public ConversationViewHolder(Context context, ViewGroup root, OnRecyclerViewClickListener listener) {
        super(context, root, R.layout.item_conversation);
        this.listener = listener;
    }


    @Override
    public void bindData(final MyConversation myConversation) {
        tvName.setText(myConversation.getName());
//获取
        tvDate.setText(myConversation.getEmConversation().getAllMsgCount() + "");
        itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (null != listener) {
                    listener.onRecyclerViewCLick(myConversation.getName());
                }
            }
        });
    }


}
